I write the physics code in ROBLOX and have just finished a major re-write to add articulated characters. The new engine is fast, simple and easier to maintain (we hope!). When I look at what I threw out, I see lots of code that was prematurely optimized.
Some background on the ROBLOX physics engine. It’s designed to handle colliding bodies and joints in roughly order-N time. This means that 1000 colliding bodies should only be twice as slow as 500 colliding bodies. The engine is constantly evolving and has not been highly optimized. For example, there are many areas of the ROBLOX engine that would lend themselves to SIMD code (doing four numeric operations in parallel). This has not been done yet. The engine has been designed to work on n-core processing architectures, but once again we have not made this optimization. We’re looking forward to getting our hands on a quad-core box to see if our physics really runs 4x faster!
Continue reading